<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
    <link href="/layui/css/layui.css" rel="stylesheet">
    <script type="text/javascript" src="/layui/layui.js"></script>
    <script type="text/javascript" src="/js/funs.js"></script>
</head>
<body>
<script type="text/html" id="toptoolbar">
    <div class="layui-form">
        <div class="layui-form-item">
            <input name="l_user.name">
            <button class="layui-btn layui-btn-sm layui-bg-cyan" lay-event="search">查询</button>

        </div>
    </div>
</script>
<script type="text/html" id="rowtoolbar">
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<table id="mytab" lay-filter="mytab"></table>
<script type="text/javascript">

    var tab = new LayTable("indexpage");
    var cols = [ //表头
        {field: 'denglurenname', title: '登录人', width: 100}
        , {field: 'sexname', title: '性别', width: 80}
        , {field: 'denglushijian', title: '登录时间', width: 240}
        , {fixed: 'right', width: 150, align: 'center', toolbar: '#rowtoolbar'}
    ];
    tab.RowClick = function (event, row) {
        switch (event) {
            case 'del':
                openConfirm("确认删除?", function () {
                    ajax_get("delete?id=" + row.id, function (json) {
                        if (json.status > 0) {
                            fresh();
                        } else {
                            openAlert(json.msg);
                        }
                    });
                })

                break;
            case "edit":
                openLayer("edit.html?id=" + row.id, "修改", ["500px", "400px"])
                break;
        }
    }

    tab.ToolClick = function (event) {
        switch (event) {
            case 'search':
                tab.selectAll();
                break;
            case "insert":
                openLayer("edit.html", "新增", ["500px", "400px"])
                break;
        }
    }
    tab.init(cols, true);

    function fresh() {
        tab.fresh();
    }


</script>

</body>
</html>